/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Dragon License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.Dragon.com/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dragon.service.impl;

import java.io.Serializable;
import java.util.List;

import com.dragon.hibernate.dao.IBaseDao;
import com.dragon.service.IBaseService;

/**
 * @author Dragon Li
 * 2013-3-22 下午2:50:37
 * version v0.1
 */
public class BaseService <E extends Serializable, PK extends Serializable> extends Service implements IBaseService<E, PK> {
	
	private IBaseDao<E, PK> baseDao;

	public IBaseDao<E, PK> getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(IBaseDao<E, PK> baseDao) {
		this.baseDao = baseDao;
	}
	
	@Override
	public E get(PK id) {
		return baseDao.get(id);
	}
	
	@Override
	public E load(PK id) {
		return baseDao.load(id);
	}
	
	@Override
	public List<E> get(PK[] ids) {
		return baseDao.get(ids);
	}
	
	@Override
	public E get(String propertyName, Object value) {
		return baseDao.get(propertyName, value);
	}
	
	@Override
	public List<E> getList(String propertyName, Object value) {
		return baseDao.getList(propertyName, value);
	}
	
	@Override
	public List<E> getAll() {
		return baseDao.getAll();
	}
	
	@Override
	public boolean isExist(String propertyName, Object value) {
		return baseDao.isExist(propertyName, value);
	}
	
	@Override
	public Serializable save(Serializable entity) {
		return baseDao.save(entity);
	}
	
	@Override
	public void deleteById(PK id) {
		baseDao.deleteById(id);
	}
	
	@Override
	public void delete(PK[] ids) {
		baseDao.delete(ids);
		this.baseDao.delete(ids);
	}
	
	
	
}
